using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
using Jazmin;
using JSCompress;

namespace SiliverlightJavascriptIntelli
{
    public partial class Generate : Form
    {
        public Generate()
        {
            InitializeComponent();
        }

        private void btnStart_Click(object sender, EventArgs e)
        {
            textBox1.Text = SilverlightJavascriptIntellisenseGenrator.GetJavascript();

            CreateFiles();
        }

        private void CreateFiles()
        {
            File.WriteAllText(@"~/../../../../ReleaseJS/intellisense.js", textBox1.Text);


            JSCompress.JSCompressor compress = new JSCompressor();
            compress.CompressVariableNames = true;
            compress.LineFeedRemoval = true;
            File.WriteAllText(@"~/../../../../ReleaseJS/intellisense.compressed.js", JavaScriptCompressor.Compress(textBox1.Text));



            if (Directory.Exists(@"C:\Documents and Settings\Justin-Josef Angel\My Documents\Expression\Expression Blend Projects\demoSilverlight"))
            {
                File.WriteAllText(@"C:\Documents and Settings\Justin-Josef Angel\My Documents\Expression\Expression Blend Projects\demoSilverlight\intellisense.js", textBox1.Text);
                File.WriteAllText(@"C:\Documents and Settings\Justin-Josef Angel\My Documents\Expression\Expression Blend Projects\demoSilverlight\intellisense.compressed.js", JavaScriptCompressor.Compress(textBox1.Text));
            }
        }

        private void tbxInput_TextChanged(object sender, EventArgs e)
        {
            tbxResult.Text = SilverlightJavascriptIntellisenseRemover.RemoveFrom(tbxInput.Text);
        }

        private void label2_Click(object sender, EventArgs e)
        {

        }
    }
}